package com.javatraining.corejava.homework.car;

/**
 * @author kmatharasi
 * 
 * Class to define atleast 5 states , 5 methods for creating a  car object .
 *
 */
public class Car {
	
	// below are the different states that are useful to define a Car .
	
	private String model;
	
	public String getModel() {
		return model;
	}



	public void setModel(String model) {
		this.model = model;
	}



	public String getMake() {
		return make;
	}



	public void setMake(String make) {
		this.make = make;
	}



	public String getVinNumber() {
		return vinNumber;
	}



	public void setVinNumber(String vinNumber) {
		this.vinNumber = vinNumber;
	}



	public int getYear() {
		return year;
	}



	public void setYear(int year) {
		this.year = year;
	}



	public int getGear() {
		return gear;
	}



	public void setGear(int gear) {
		this.gear = gear;
	}



	public int getCurrentSpeed() {
		return currentSpeed;
	}



	public void setCurrentSpeed(int currentSpeed) {
		this.currentSpeed = currentSpeed;
	}



	public boolean isEngineOn() {
		return engineOn;
	}



	public void setEngineOn(boolean engineOn) {
		this.engineOn = engineOn;
	}



	public float getWiperFluidLevel() {
		return wiperFluidLevel;
	}



	public void setWiperFluidLevel(float wiperFluidLevel) {
		this.wiperFluidLevel = wiperFluidLevel;
	}



	public float getCoolantLevel() {
		return coolantLevel;
	}



	public void setCoolantLevel(float coolantLevel) {
		this.coolantLevel = coolantLevel;
	}



	public float getBrakeFluidLevel() {
		return brakeFluidLevel;
	}



	public void setBrakeFluidLevel(float brakeFluidLevel) {
		this.brakeFluidLevel = brakeFluidLevel;
	}


	private String make;
	
	private String vinNumber;
	
	private int year;
	
	private int gear;
	
	private int currentSpeed;
	
	private boolean engineOn=false;
	
	private float wiperFluidLevel;
	
	private float coolantLevel;
	
	private float brakeFluidLevel;

	
	// below are the 5 different behaviors that a Car exhibits .
	
	
	 public void start()
	 
	 {
		 if(engineOn=true)
		 {
			 System.out.println("Car is started");
			 System.out.println("----------------");
		 }		 		 
		 
	 }
	 
	 
	 
	 public void accelerate(int gear, int currentSpeed)
		
	 {
		 this.gear = gear;
		 
		 System.out.println("Current Gear " + gear);
		 System.out.println("-----------------------");
		 
		 System.out.println("Current Speed " + currentSpeed);
		 System.out.println("-------------------------------");
		 
		 if(currentSpeed > 0 || gear > 1 &&  engineOn==true )
		 {
			 System.out.println("Car is accelerated");
			 System.out.println("-------------------");
		 }
		 	 
	 }
	 
	  
		
	 public void decelerate(int gear,int currentSpeed)
		
	 {
		 this.gear = gear;
		 
		 System.out.println("Current Gear " + gear);
		 System.out.println("----------------------");
		 
		 System.out.println("Current Speed " + currentSpeed);
		 System.out.println("------------------------------");
		 
		 if(gear < 2 || engineOn==false || currentSpeed<=10)
		 {
			 System.out.println("Car is decelerated");
			 System.out.println("-------------------");
		 }
		 
	 }
	
	 
	
	
	 public void changeGear( int gear)
		
	 {
		 this.gear = gear;
		 
		 switch (gear)
		 {
		 case 1: System.out.println("Car is in gear 1");
		 System.out.println("-------------------------");
		 break;
		 
		 case 2: System.out.println("Car is in gear 2");
		 System.out.println("--------------------------");
		 break;
		 
		 case 3: System.out.println("Car is in gear 3");
		 System.out.println("-------------------------");
		 break;
		 
		 case 4: System.out.println("Car is in gear 4");
		 System.out.println("-------------------------");
		 break;
		 
		 case 5: System.out.println("Car is in reverse gear");
		 System.out.println("--------------------------------");
		 break;
		 
		 default:
		 {
			 System.out.println("Invalid Gear Option");
			 System.out.println("------------------");
		 }
		 
		 }
		 		 
	 }
	
	
	 public void stop(boolean engineOn,int gear)
		
	 {
		 
		 this.engineOn = engineOn;
		 this.gear = gear;
		 
		 if(engineOn=false || gear==0)
		 {
			 System.out.println("Car is  stopped");
			 System.out.println("--------------");
		 }
		 
		 
	 }
	 
	 
	 public void changeFluids(float wiperFluidLevel,float brakeFluidLevel,float coolantLevel)
	 
	 {
		 this.wiperFluidLevel = wiperFluidLevel;
		 
		 this.brakeFluidLevel = brakeFluidLevel;
		 
		 this.coolantLevel = coolantLevel;
		 
		 if(wiperFluidLevel < 0.5)
		 {
			 System.out.println("Change Wiper Fluid");
		 }
		 
		 else if (brakeFluidLevel < 0.5)
		 {
			 System.out.println("Change Break Fluid");
		 }
		 
		 else if (coolantLevel < 0.5)
		 {
			 System.out.println("Change Coolant Fluid");
		 }
		 
		 else
		 {
			 System.out.println("No fluid refill required");
		 }
	 }
	

	

}
